package aoi.retail_system.controller;


import aoi.retail_system.model.Order;
import aoi.retail_system.service.OrderService;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/orders")
public class OrderController {
    private final OrderService orderService;
    public OrderController(OrderService orderService) {
        this.orderService = orderService;
    }
    //创建订单
    @PostMapping
    public void createOrder(@RequestBody Order order){
        orderService.createOrder(order);
    }
    //更新订单状态
    @PutMapping("/{id}")
    public void updateOrderStatus(@PathVariable Long id, @RequestParam String status){
        orderService.updateOrderStatus(id,status);
    }

}
